<template>
    <div>
        <h1>我是a组件</h1>
        <button @click="sendFn">点我，发送数据给b组件</button>
    </div>
</template>

<script>
import eventBus from '../eventBus/index.js'
export default {
    data(){
        return {
            msg: "我是a组件中的数据"
        }
    },
    methods: {
        sendFn(){
            eventBus.$emit("sendData", this.msg)
        }
    }
}
</script>

<style>

</style>